<?php
include('../../inc/global.inc');
include("../islogin.php");
if($_GET['del_act']){
mysql_query("delete from pf_catalog where id='".$_GET['del_id']."'");
echo "<script>location='catalog.php';</script>";
}
?>
<HTML>
<HEAD>
<TITLE>Admin</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<LINK href="../css/css.css" rel=stylesheet>
<script type='text/javascript' src="../js/islogin.js" charset="gb2312"></script>
</HEAD>
<BODY>
<center>
  <table width="60%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
    <tr>
      <td height="25" bgcolor="#EEEEF9" style="padding-left:5px;">批发目录 &nbsp;&nbsp;<a href="javascript:history.go(-1)">返回</a></td>
    </tr>
  </table>
  <table width="60%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
    <tr>
      <td width="12%" height="30" align="center" bgcolor="#8DA8CF">编号</td>
      <td width="44%" align="center" bgcolor="#8DA8CF">批发目录名</td>
      <td width="19%" align="center" bgcolor="#8DA8CF">是否推荐</td>
      <td width="25%" align="center" bgcolor="#8DA8CF"><a href="catalog_modify.php?tj=ok&id=<?=$_GET[id]?>">添加批发目录</span></a></td>
    </tr>
<?php
if($_GET[id]){
$sql="select * from pf_catalog where cat_id='".$_GET['id']."' order by id asc";
}else{
$sql="select * from pf_catalog where cat_id=0 order by id asc";}
$rs=mysql_query($sql);
$i=1;
while($row=mysql_fetch_array($rs)){
$color=($i%2)?"#FFFFFF":"#eeeeee";
$rs2=mysql_query("select * from pf_catalog where cat_id='".$row['id']."'");
$row2=mysql_fetch_array($rs2);
$num=mysql_num_rows($rs2);
mysql_free_result($rs2);
?>
    <tr bgcolor=<?=$color?>>
      <td height="25" align="center"><?=$i?></td>
	  <td align="left" style="padding-left:10px;"><?php if($row[c_ping]){echo "<font color='blue'>$row[c_ping]</font>-";}?><?=$row[cat_name]?>(<a href='catalog.php?id=<?=$row['id']?>'><font color='red'><?=$num?></font></a>)</td>
      <td align="center" style="padding-left:10px;"><?php if($row[cat_tj]==1){echo "<font color='red'>是</font>";}else{echo "否";}?></td>
      <td align="center"><a href="catalog_modify.php?xg=ok&xg_id=<?=$row['id']?>">编辑</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="catalog.php?del_act=ok&del_id=<?=$row['id']?>" onClick="return del()">删除</a></td>
    </tr>
<?php
$i++;}
?>
  </table>
</center>
</BODY>
</HTML>
